Skip to content

Fix false InvalidArgument for sprintf precision placeholders#11729

Merged
danog merged 1 commit intovimeo:6.xfrom
eyupcanakman:fix/sprintf-precision-11721
Mar 17, 2026
Merged

Fix false InvalidArgument for sprintf precision placeholders#11729
danog merged 1 commit intovimeo:6.xfrom
eyupcanakman:fix/sprintf-precision-11721

Conversation

@eyupcanakman
Copy link
Contributor

Fix #11721

Psalm validates some sprintf/printf formats by calling them with dummy values. For .* precision placeholders that used empty strings, PHP 8 raises a false ValueError and Psalm reported InvalidArgument.

Validate complex * width and precision placeholders with integer dummies before falling back to the generic return type. Add regressions for %.*f, positional variants, and related arity errors.

Fix vimeo#11721

Psalm validates some sprintf/printf formats by calling them with dummy values. For .* precision placeholders that used empty strings, PHP 8 raises a false ValueError and Psalm reported InvalidArgument.

Validate complex * width and precision placeholders with integer dummies before falling back to the generic return type. Add regressions for %.*f, positional variants, and related arity errors.
eyupcanakman added a commit to eyupcanakman/endtoend-test-collections that referenced this pull request Mar 15, 2026
Update psalm-baseline.xml for vimeo/psalm#11729.

The sprintf precision placeholder fix removes several Missing* baseline entries in this fixture project, so the baseline needs to be regenerated with the current Psalm branch.
@danog danog added the release:fix The PR will be included in 'Fixes' section of the release notes label Mar 17, 2026
@danog
Copy link
Collaborator

danog commented Mar 17, 2026

Thanks!

@danog danog merged commit a247bd6 into vimeo:6.x Mar 17, 2026
58 of 61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:fix The PR will be included in 'Fixes' section of the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sprintf precision parameter type misidentification

2 participants